<html>
<head>
<link href="{{HTTP_BASE_URL}}/resources/js/tipuesearch/tipuesearch.css" rel="stylesheet">
<link rel='stylesheet' href='{{HTTP_BASE_URL}}/resources/css/doc.css'>
<script src="{{HTTP_BASE_URL}}/resources/js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="{{HTTP_BASE_URL}}/resources/js/tipuesearch/tipuesearch_set.js"></script>
<script src="{{HTTP_BASE_URL}}/resources/js/tipuesearch/tipuesearch.js"></script>
</head>
<body style='margin-left: 50px; max-width: 1000px'>

<h1>Documentation Search</h1>

<form action="search.html">
<input type="text" name="q" id="tipue_search_input" autocomplete="off" required>
</form>
    
<div id="tipue_search_content">
    <div class="">
        <p>Searching, please stand by...</p>
        <div class="tipue_search_rect1"></div>
        <div class="tipue_search_rect2"></div>
        <div class="rect3"></div>
    </div>
</div>

    <div id="hidden" style="display: none;"></div>
<script>
$(document).ready(function() {
    $("#hidden").load("{{HTTP_BASE_URL}}/doc/builtin/toc.md.html a", function(){
        var blacklist = [
            "{{HTTP_BASE_URL}}/",
            "{{HTTP_BASE_URL}}/doc/rest.html",
            "{{HTTP_BASE_URL}}/doc/builtin/datasets/DatasetConfig.md.html",
            "{{HTTP_BASE_URL}}/doc/builtin/procedures/ProcedureConfig.md.html",
            "{{HTTP_BASE_URL}}/doc/builtin/functions/FunctionConfig.md.html",
            "{{HTTP_BASE_URL}}/doc/builtin/plugins/PluginConfig.md.html",
        ];
        window.tipuesearch_pages = [];

        $("#hidden > a").each(function(){
            var url = $(this).attr("href").split("#")[0];
            if(url[0] != "/"){ url = "{{HTTP_BASE_URL}}/doc/builtin/"+url; }
            if(blacklist.indexOf(url) == -1 && 
               window.tipuesearch_pages.indexOf(url) == -1) { 
                window.tipuesearch_pages.push(url); 
            }
        });
        
        setTimeout(function() {
        $('#tipue_search_input').tipuesearch({ 
            'mode': 'live',
            'show'                   : 10,
            'newWindow'              : false,
            'showURL'                : true,
            'minimumLength'          : 1,
            'descriptiveWords'       : 20,
            'highlightTerms'         : false,
            'highlightEveryTerm'     : false
        });
        }, 100);
    });
});
</script>
</body>
